import toolMgr from '@/biz/base/tool.js'
import dt from '@dt/dt'

let _this = null

import incentiveMgr from '@/biz/bonus/incentive'
import ProBuildUnit from './pro'


function getWorkNo(info) {
  let opt = {
    change: () => {
      info.workNo = null
      _this.update()
    }
  }
  if (info.workNo) {
    opt.options = [{
      key: info.workNo,
      value: info.uername
    }]
  }
  return incentiveMgr.createPeople(opt)
}


function options(vm) {

  let proBuildUnit = new ProBuildUnit()
  _this = vm
  return [

    getWorkNo(_this.info),
    ...proBuildUnit.options(_this),
    [{
      key: 'bonusMoney',
      title: '应付奖金',
      placeholder: '请输入发放金额',
      minWidth: 220,
      input: {
        type: 'number',
      },
      rules: [{
        required: true,
        type:'number',
        message: '请输入发放金额',
        trigger: 'blur'
      }]
    }]
  ]
}

export default {
  options
}